package org.karelun.gef.commands;

import org.eclipse.draw2d.geometry.Point;
import org.karelun.gef.model.AbstractConnectionModel;

public class DeleteBendpointCommand extends AbstractCommand{

	private AbstractConnectionModel connection;
	private Point oldLocation;
	private int index;
	
	public void execute(){
		oldLocation= connection.getBendPoints().get(index);
		connection.removeBendpoint(index);
	}
	public void setConnectionModel(Object model){
		connection=(AbstractConnectionModel)model;
	}
	public void setIndex(int i){
		index=i;
	}
	public void undo(){
		connection.addBendpoint(index, oldLocation);
	}
	@Override
	public void redo() {
		execute();
	}
}
